﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SEMS.Controllers.Admin
{
    public class LoginController : Controller
    {
        //
        // GET: /Login/

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Index(Models.Administrater model)
        {
            if (ModelState.IsValid)
            {
                if (BLL.AdministraterBS.IsValid(model.admin_id, model.admin_pwd))
                {
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", "用户名或密码错误！");
                }
            }

            // 登陆失败
            return View(model);
        }
    }
}
